using System;
using System.Diagnostics;
using Debug = UnityEngine.Debug;

namespace SGEngine.ProfilerEx
{
    public class EditorTimeCounter : IDisposable
    {
        private string m_Tag;
        private Stopwatch m_StopWatch;
        public EditorTimeCounter(string tag)
        {
            m_Tag = tag;
            m_StopWatch = new Stopwatch();
            m_StopWatch.Start();
        }
        public void Dispose()
        {
            m_StopWatch.Stop();
            Debug.Log($"{m_Tag} cost:{m_StopWatch.Elapsed:c}");
        }
    }
}